<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%>
<s:url value="/images" var="imgPath"/>
<!-- 月历 -->
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick-zh-CN.js"></script>
<link rel="stylesheet" type="text/css" href="/css/smoothness.datepick.css" />
<!-- 時間 -->	
<script type="text/javascript" charset="UTF-8" src="/js/jquery-ui-1.7.2.custom.min.js"></script>
<link rel="stylesheet" type="text/css" href="/css/jquery-ui-1.7.2.custom.css"/>

<script language="javascript">
	$().ready( function() {
		$('#paramStartDateTime').datepick({minDate: null, showOn: 'both', 
	    	buttonImageOnly: true, buttonImage: '${imgPath}/calendar.gif',numberOfMonths:2,dateFormat:"yy-mm-dd",yearRange: '-50:+50'});
		$('#paramEndDateTime').datepick({minDate: new Date(), showOn: 'both', 
		   	  buttonImageOnly: true, buttonImage: '${imgPath}/calendar.gif',numberOfMonths:2,beforeShow:customRange,dateFormat:"yy-mm-dd",yearRange: '-50:+50'});
		function customRange (){
			var startDt = $('#paramStartDateTime').val(); //起始日
			var endDt = new Date(parseInt(startDt.substring(0,4),10),parseInt(startDt.substring(5,7),10)-1,parseInt(startDt.substring(8,10),10)); //結束日
			return {minDate:endDt}; 
		}
	});	
</script>
<s:actionerror />
<s:actionmessage />
<s:fielderror />
<br />
<h1>满额购活动管理
<div class="f-link">
<a href="add.do">新增</a>
<a href="#" onclick="document.formObj.submit();">搜寻</a>
</div>
</h1>
<div class="data-form">
<s:form action="search.do" method="post" name="formObj">
<table width="850">
<tr>
	<td width="15%">最低订单金额：</td>
	<td width="35%"><s:textfield name="paramMinOrderAmount"/></td>
	<td width="15%">商品代码：</td>
	<td width="35%"><s:textfield name="paramProductId"/></td>
</tr>
<tr>
	<td width="15%">活动时间：</td>
	<td width="35%">
	<input name="paramStartDateTime" id="paramStartDateTime" size="10" value="<fmt:formatDate value="${paramStartDateTime}" pattern="yyyy-MM-dd"/>">
	~
	<input name="paramEndDateTime" id="paramEndDateTime" size="10" value="<fmt:formatDate value="${paramEndDateTime}" pattern="yyyy-MM-dd"/>">
	</td>
	<td width="15%">启用：</td>
	<td width="35%"><s:checkboxlist list="#{'true':'是','false':'否'}" listKey="key" listValue="value" name="paramEnable"/></td>
</tr>
</table>
</s:form>
</div>
<br/><br/>
	<table class="tb-1" width="100%">
		<thead>
			<tr>
				<th>#</th>
				<th>加购商品</th>
				<th>最低订单金额</th>
				<th>商品金额</th>
				<th>适用对象</th>
				<th>活动开始时间</th>
				<th>活动结束时间</th>
				<th>启用</th>
			</tr>
		</thead>
		<s:if test="campaignList.size > 0">
		<tbody>
			<c:forEach items="${campaignList}" var="campaign" varStatus="rows_index">
				<tr class="${rows_index.count % 2 == 0 ? 'bg-yl' : ''}">
					<td><fmt:formatNumber
						pattern="0000" value="${rows_index.count + pager.currentPage*20}" /></td>
					<td><a href="view.do?uuid=${campaign.uuid}" /><c:out value="${campaign.productId}"/></a></td>
					<td><fmt-rt:formatNumber value="${campaign.minOrderAmount}" pattern="￥######0.0"/></td>
					<td><fmt-rt:formatNumber value="${campaign.price}" pattern="￥######0.0"/></td>
					<td>${menuMemberRank.options[campaign.allowMemberRank].name}</td>
					<td><fmt:formatDate value="${campaign.startDateTime}"
						pattern="yyyy-MM-dd HH:mm:ss" /></td>
					<td><fmt:formatDate value="${campaign.endDateTime}"
						pattern="yyyy-MM-dd HH:mm:ss" /></td>
					<td><c:if test="${campaign.enable}">是</c:if><c:if test="${!campaign.enable}">否</c:if></td>
				</tr>
			</c:forEach>
		</tbody>
		</s:if>
		<s:else>
			<tbody>
				<tr class="bg-yl"><td colspan="6">查无资料!!</td></tr>
			</tbody>
		</s:else>
	</table>	
	<yaodian100:pageutil link="search.do" pagerObj="${pager}" />
